#include"test.h"

void* my_memcpy(void* dst, const void* src, size_t n)
{
    auto d = static_cast<unsigned char*>(dst);
    auto t = static_cast<const unsigned char*>(src);
    for(int i = 0; i < n; i++) *(d + i) = *(t + i);
    return dst;
}

void* my_memmove(void* dst, const void* src, size_t n)
{
    auto d = static_cast<unsigned char*>(dst);
    auto t = static_cast<const unsigned char*>(src);
    if(d < t || d >= t + n)
        for(int i = 0; i < n; i++) *(d + i) = *(t + i);
    else
        for(int i = (int)n - 1; i >= 0; i--) *(d + i) = *(t + i);
    return dst;
}